package com.fowo.api.sys.rdp.aop;

import com.fowo.api.sys.rdp.RelDataPermissionsService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 切面方法
 * @author yl_ls
 */
@Slf4j
@Aspect
@Component
public class RelDataPermissionsAop {
    @Resource
    private RelDataPermissionsService relDataPermissionsService;

    @Pointcut("execution(* com.fowo.api.service..*.*(..))")
    public void pointcut() {}

    @After("pointcut()")
    public void afterMethodInvoke(JoinPoint joinPoint) {
        if (relDataPermissionsService != null && joinPoint != null && joinPoint.getSignature() != null) {
            String name = joinPoint.getSignature().toShortString();
            relDataPermissionsService.afterMethodInvoke(name);
        }
    }
}
